import { Tray, app, Menu } from 'electron'
// import path from 'path'
import { isWindows } from '@/utils/verify'
const path = require('path')

export default function useTray() {
  const tray = new Tray(path.join(__dirname, 'favicon.ico'))
  // const tray = new Tray(path.join('', 'logo_win.ico'));
  if (isWindows()) {
    const trayMenu = [
      {
        label: '退出桌面软件',
        click: () => {
          app.exit()
        }
      }
    ]
    const contextMenu = Menu.buildFromTemplate(trayMenu)
    tray.setContextMenu(contextMenu)
  }
  tray.setToolTip('桌面软件')
  return tray
}
